package cn.net.autocode.platform.customDict.dict;

import cn.net.autocode.core.bean.ResultT;
import cn.net.autocode.dbManager.Dao;
import cn.net.autocode.platform.customDict.CustomDict;
import cn.net.autocode.platform.customDict.CustomDictAnnotation;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.stereotype.Component;

@CustomDictAnnotation("restApi")
@Component("autocode_platform_restApi")
public class RestApiDict implements CustomDict {
    private final Dao dao;

    public RestApiDict(Dao dao) {
        this.dao = dao;
    }

    @Override
    public ResultT query(JSONObject param) {
        JSONArray array = dao.queryJSONArray("select code value,label from sys_rest_api order by label");
        return ResultT.success(array);
    }
}
